from rules.peaces.AbstractPeace import AbstractPeace;
from core import Utils;
from core import PlayerColor;
from core.PeacePosition import PeacePosition;
from core import PeaceType;

class VaukalakPeace(AbstractPeace):

    def __init__(self, controller, type):
        AbstractPeace.__init__(self, controller, type);

    def checkMotion(self, sP, fP):
        dX = abs(sP.x - fP.x);
        dY = abs(sP.y - fP.y);
        targetCell = self._controller.boardData.getPeaceByCell(fP);
        targetCellIsNotMy = Utils.getPeaceColor(targetCell) != self._getMyColor();
        if(targetCellIsNotMy and ((dX == 2 and dY == 1) or (dX == 1 and dY == 2))):
            return True;
        else:
            return False;